<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>demo</title>
<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://cdn.bootcss.com/bootstrap-table/1.11.1/bootstrap-table.min.css" rel="stylesheet">
<script src="https://cdn.bootcss.com/bootstrap-table/1.11.1/bootstrap-table.min.js"></script>

<script src="https://cdn.bootcss.com/bootstrap-table/1.11.1/extensions/export/bootstrap-table-export.min.js"></script>
<script src="tableExport/libs/pdfmake/pdfmake.min.js"></script>
<script src="tableExport/libs/pdfmake/vfs_fonts.js"></script>
<script src="tableExport/libs/FileSaver/FileSaver.min.js"></script>
<script src="tableExport/tableExport.js"></script>
<!—如果想使用中文版也可以引入以下语言包 -->
<script src="https://cdn.bootcss.com/bootstrap-table/1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
</head>
<body>
<div class='container'>
<h1>导出excel、pdf、doc</h1>
<table id="table"></table>
</div>
<script>
$(function(){
	$('#table').bootstrapTable({		
		showExport:true,
		exportTypes:['excel','pdf','doc'],  //导出文件类型
        //exportDataType: "basic",              //basic', 'all', 'selected'.
		Icons:'glyphicon-export',
		exportOptions:{
			//ignoreColumn: [0,1],  //忽略某一列的索引
			fileName: '导出表格',  //文件名称设置
			worksheetName: 'sheet1',  //表格工作区名称
			tableName: '导出表格',
			excelstyles: ['background-color', 'color', 'font-size', 'font-weight']
		},
		columns: [{
			field: 'id',
			title: 'Item ID'
		}, {
			field: 'name',
			title: 'Item Name'
		}, {
			field: 'price',
			title: 'Item Price'
		}],
		data: [{
			id: 1,
			name: 'Item 1',
			price: '$1'
		}, {
			id: 2,
			name: 'Item 2',
			price: '$2'
		}]
	});
});
</script>
</body>
</html>